package com.zhejiangzhengyuan.municipal_common.service.impl;

import com.zhejiangzhengyuan.municipal_common.entity.CaseWarnEventMapping;
import com.zhejiangzhengyuan.municipal_common.mapper.CaseWarnEventMappingMapper;
import com.zhejiangzhengyuan.municipal_common.service.CaseWarnEventMappingService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import static com.zhejiangzhengyuan.municipal_common.utils.DateFormatUtil.timeFormat;

/**
 * <p>
 * 案件与警报事件关联表，记录案件与警报数据的一对一关联关系 服务实现类
 * </p>
 *
 * @author linju
 * @since 2019-11-22
 */
@Service
public class CaseWarnEventMappingServiceImpl extends ServiceImpl<CaseWarnEventMappingMapper, CaseWarnEventMapping> implements CaseWarnEventMappingService {

    @Autowired
    private CaseWarnEventMappingMapper caseWarnEventMappingMapper;
    @Override
    public long insertCaseWarnMapping(long cid, long wid) {
        CaseWarnEventMapping caseWarnEventMapping=new CaseWarnEventMapping();
        caseWarnEventMapping.setCaseId(cid);
        caseWarnEventMapping.setWarnEventId(wid);
        caseWarnEventMapping.setCreateTime(timeFormat(System.currentTimeMillis()));
        caseWarnEventMapping.setUpdateTime(timeFormat(System.currentTimeMillis()));
        return caseWarnEventMappingMapper.insert(caseWarnEventMapping);
    }
}
